package com.itheima.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 消息实体
 * @author 51585
 * @TableName news
 */
@TableName(value ="news")
@Data
@ApiModel(value = "消息")
public class News implements Serializable {
    private static final long serialVersionUID = -4392050167724655256L;
    /**
     * 
     */
    @ApiModelProperty(value = "id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 发送用户id
     */
    @ApiModelProperty(value = "发送用户id")
    @TableField(value = "send_id")
    private String sendId;

    /**
     * 接收用户id
     */
    @ApiModelProperty(value = "接收用户id",required = true)
    @TableField(value = "accept_id")
    @NotNull
    private String acceptId;

    /**
     * 发送时间
     */
    @ApiModelProperty(value = "发送时间", required = true)
    @TableField(value = "send_time", fill = FieldFill.INSERT)
    @NotNull
    private LocalDateTime sendTime;

    /**
     * 是否已读，1为已读，0为未读
     */
    @ApiModelProperty(value = "是否已读")
    @TableField(value = "read_status")
    private Integer readStatus;

    /**
     * 消息内容
     */
    @ApiModelProperty(value = "消息内容", required = true, notes = "字数最大为255")
    @TableField(value = "content")
    @NotNull
    private String content;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "updated_at", fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    /**
     * 删除时间
     */
    @ApiModelProperty(value = "删除时间")
    @TableField(value = "deleted_at")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableLogic
    private LocalDateTime deletedAt;

}